home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / PInterfaces / QD3D.p < prev    next >
Encoding:
Text File  |  1998-02-12  |  32.9 KB  |  1,009 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        QD3D.p
  3.  
  4.      Contains:    Base types for Quickdraw 3D                            
  5.  
  6.      Version:    Technology:    Quickdraw 3D 1.5.4
  7.                  Release:    Universal Interfaces 3.1
  8.  
  9.      Copyright:    © 1995-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT QD3D;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __QD3D__}
  28. {$SETC __QD3D__ := 1}
  29.  
  30. {$I+}
  31. {$SETC QD3DIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __CONDITIONALMACROS__}
  35. {$I ConditionalMacros.p}
  36. {$ENDC}
  37.  
  38. {$IFC TARGET_OS_MAC }
  39. {$IFC UNDEFINED __MACTYPES__}
  40. {$I MacTypes.p}
  41. {$ENDC}
  42. {$ENDC}  {TARGET_OS_MAC}
  43.  
  44.  
  45. {$PUSH}
  46. {$ALIGN POWER}
  47. {$LibExport+}
  48.  
  49. {$IFC TARGET_OS_MAC }
  50. {$SETC OS_MACINTOSH := 1 }
  51. {$SETC OS_WIN32 := 0 }
  52. {$SETC OS_UNIX := 0 }
  53. {$SETC OS_NEXT := 0 }
  54. {$SETC WINDOW_SYSTEM_MACINTOSH := 1 }
  55. {$SETC WINDOW_SYSTEM_WIN32 := 0 }
  56. {$SETC WINDOW_SYSTEM_X11 := 0 }
  57. {$SETC WINDOW_SYSTEM_NEXT := 0 }
  58. {$ENDC}  {TARGET_OS_MAC}
  59.  
  60.  
  61. {*****************************************************************************
  62.  **                                                                             **
  63.  **                                NULL definition                                 **
  64.  **                                                                             **
  65.  ****************************************************************************}
  66. {*****************************************************************************
  67.  **                                                                             **
  68.  **                                    Objects                                     **
  69.  **                                                                             **
  70.  ****************************************************************************}
  71. {
  72.  * Everything in QuickDraw 3D is an OBJECT: a bunch of data with a type,
  73.  * deletion, duplication, and i/o methods.
  74.  }
  75. {$IFC TARGET_OS_MAC }
  76.  
  77. TYPE
  78.     TQ3ObjectType                        = FourCharCode;
  79. {$ELSEC}
  80.  
  81. TYPE
  82.     TQ3ObjectType                        = LONGINT;
  83. {$ENDC}  {TARGET_OS_MAC}
  84.  
  85.     TQ3ObjectTypePtr                    = ^TQ3ObjectType;
  86.     TQ3Object = ^LONGINT;
  87. {
  88.  * There are four subclasses of OBJECT:
  89.  *    an ELEMENT, which is data that is placed in a SET
  90.  *    a SHAREDOBJECT, which is reference-counted data that is shared
  91.  *    VIEWs, which maintain state information for an image
  92.  *    a PICK, which used to query a VIEW
  93.  }
  94.     TQ3ElementObject                    = TQ3Object;
  95.     TQ3SharedObject                        = TQ3Object;
  96.     TQ3ViewObject                        = TQ3Object;
  97.     TQ3PickObject                        = TQ3Object;
  98. {
  99.  * There are several types of SharedObjects:
  100.  *    RENDERERs, which paint to a drawContext
  101.  *    DRAWCONTEXTs, which are an interface to a device 
  102.  *    SETs, which maintains "mathematical sets" of ELEMENTs
  103.  *    FILEs, which maintain state information for a metafile
  104.  *    SHAPEs, which affect the state of the View
  105.  *    SHAPEPARTs, which contain geometry-specific data about a picking hit
  106.  *    CONTROLLERSTATEs, which hold state of the output channels for a CONTROLLER
  107.  *    TRACKERs, which represent a position and orientation in the user interface
  108.  *  STRINGs, which are abstractions of text string data.
  109.  *    STORAGE, which is an abstraction for stream-based data storage (files, memory)
  110.  *    TEXTUREs, for sharing bitmap information for TEXTURESHADERS
  111.  *    VIEWHINTs, which specifies viewing preferences in FILEs
  112.  }
  113.     TQ3RendererObject                    = TQ3SharedObject;
  114.     TQ3DrawContextObject                = TQ3SharedObject;
  115.     TQ3SetObject                        = TQ3SharedObject;
  116.     TQ3FileObject                        = TQ3SharedObject;
  117.     TQ3ShapeObject                        = TQ3SharedObject;
  118.     TQ3ShapePartObject                    = TQ3SharedObject;
  119.     TQ3ControllerStateObject            = TQ3SharedObject;
  120.     TQ3TrackerObject                    = TQ3SharedObject;
  121.     TQ3StringObject                        = TQ3SharedObject;
  122.     TQ3StorageObject                    = TQ3SharedObject;
  123.     TQ3TextureObject                    = TQ3SharedObject;
  124.     TQ3ViewHintsObject                    = TQ3SharedObject;
  125. {
  126.  * There is one types of SET:
  127.  *    ATTRIBUTESETs, which contain ATTRIBUTEs which are inherited 
  128.  }
  129.     TQ3AttributeSet                        = TQ3SetObject;
  130.     TQ3AttributeSetPtr                    = ^TQ3AttributeSet;
  131. {
  132.  * There are many types of SHAPEs:
  133.  *    LIGHTs, which affect how the RENDERER draws 3-D cues
  134.  *    CAMERAs, which affects the location and orientation of the RENDERER in space
  135.  *    GROUPs, which may contain any number of SHARED OBJECTS
  136.  *    GEOMETRYs, which are representations of three-dimensional data
  137.  *    SHADERs, which affect how colors are drawn on a geometry
  138.  *    STYLEs, which affect how the RENDERER paints to the DRAWCONTEXT
  139.  *    TRANSFORMs, which affect the coordinate system in the VIEW
  140.  *    REFERENCEs, which are references to objects in FILEs
  141.  *  UNKNOWN, which hold unknown objects read from a metafile.
  142.  }
  143.     TQ3GroupObject                        = TQ3ShapeObject;
  144.     TQ3GeometryObject                    = TQ3ShapeObject;
  145.     TQ3ShaderObject                        = TQ3ShapeObject;
  146.     TQ3StyleObject                        = TQ3ShapeObject;
  147.     TQ3TransformObject                    = TQ3ShapeObject;
  148.     TQ3LightObject                        = TQ3ShapeObject;
  149.     TQ3CameraObject                        = TQ3ShapeObject;
  150.     TQ3UnknownObject                    = TQ3ShapeObject;
  151.     TQ3ReferenceObject                    = TQ3ShapeObject;
  152. {
  153.  * For now, there is only one type of SHAPEPARTs:
  154.  *    MESHPARTs, which describe some part of a mesh
  155.  }
  156.     TQ3MeshPartObject                    = TQ3ShapePartObject;
  157. {
  158.  * There are three types of MESHPARTs:
  159.  *    MESHFACEPARTs, which describe a face of a mesh
  160.  *    MESHEDGEPARTs, which describe a edge of a mesh
  161.  *    MESHVERTEXPARTs, which describe a vertex of a mesh
  162.  }
  163.     TQ3MeshFacePartObject                = TQ3MeshPartObject;
  164.     TQ3MeshEdgePartObject                = TQ3MeshPartObject;
  165.     TQ3MeshVertexPartObject                = TQ3MeshPartObject;
  166. {
  167.  * A DISPLAY Group can be drawn to a view
  168.  }
  169.     TQ3DisplayGroupObject                = TQ3GroupObject;
  170. {
  171.  * There are many types of SHADERs:
  172.  *    SURFACESHADERs, which affect how the surface of a geometry is painted
  173.  *    ILLUMINATIONSHADERs, which affect how lights affect the color of a surface
  174.  }
  175.     TQ3SurfaceShaderObject                = TQ3ShaderObject;
  176.     TQ3IlluminationShaderObject            = TQ3ShaderObject;
  177. {
  178.  * A handle to an object in a group
  179.  }
  180.     TQ3GroupPosition = ^LONGINT;
  181.     TQ3GroupPositionPtr                    = ^TQ3GroupPosition;
  182.  * TQ3ObjectClassNameString is used for the class name of an object
  183.  }
  184.  
  185. CONST
  186.     kQ3StringMaximumLength        = 1024;
  187.  
  188.  
  189. TYPE
  190.     TQ3ObjectClassNameString            = PACKED ARRAY [0..1023] OF CHAR;
  191. {*****************************************************************************
  192.  **                                                                             **
  193.  **                            Client/Server Things                             **
  194.  **                                                                             **
  195.  ****************************************************************************}
  196.     TQ3ControllerRef                    = Ptr;
  197. {*****************************************************************************
  198.  **                                                                             **
  199.  **                            Flags and Switches                                 **
  200.  **                                                                             **
  201.  ****************************************************************************}
  202.     TQ3Boolean                     = LONGINT;
  203. CONST
  204.     kQ3False                    = {TQ3Boolean}0;
  205.     kQ3True                        = {TQ3Boolean}1;
  206.  
  207.  
  208. TYPE
  209.     TQ3Switch                     = LONGINT;
  210. CONST
  211.     kQ3Off                        = {TQ3Switch}0;
  212.     kQ3On                        = {TQ3Switch}1;
  213.  
  214.  
  215. TYPE
  216.     TQ3Status                     = LONGINT;
  217. CONST
  218.     kQ3Failure                    = {TQ3Status}0;
  219.     kQ3Success                    = {TQ3Status}1;
  220.  
  221.  
  222. TYPE
  223.     TQ3Axis                     = LONGINT;
  224. CONST
  225.     kQ3AxisX                    = {TQ3Axis}0;
  226.     kQ3AxisY                    = {TQ3Axis}1;
  227.     kQ3AxisZ                    = {TQ3Axis}2;
  228.  
  229.  
  230. TYPE
  231.     TQ3PixelType                 = LONGINT;
  232. CONST
  233.     kQ3PixelTypeRGB32            = {TQ3PixelType}0;                {  Alpha:8 (ignored), R:8, G:8, B:8     }
  234.     kQ3PixelTypeARGB32            = {TQ3PixelType}1;                {  Alpha:8, R:8, G:8, B:8              }
  235.     kQ3PixelTypeRGB16            = {TQ3PixelType}2;                {  Alpha:1 (ignored), R:5, G:5, B:5     }
  236.     kQ3PixelTypeARGB16            = {TQ3PixelType}3;                {  Alpha:1, R:5, G:5, B:5              }
  237.     kQ3PixelTypeRGB16_565        = {TQ3PixelType}4;                {  Win32 only: 16 bits/pixel, R:5, G:6, B:5         }
  238.     kQ3PixelTypeRGB24            = {TQ3PixelType}5;                {  Win32 only: 24 bits/pixel, R:8, G:8, B:8         }
  239.  
  240.  
  241. TYPE
  242.     TQ3Endian                     = LONGINT;
  243. CONST
  244.     kQ3EndianBig                = {TQ3Endian}0;
  245.     kQ3EndianLittle                = {TQ3Endian}1;
  246.  
  247.  
  248. TYPE
  249.     TQ3EndCapMasks                 = LONGINT;
  250. CONST
  251.     kQ3EndCapNone                = {TQ3EndCapMasks}0;
  252.     kQ3EndCapMaskTop            = {TQ3EndCapMasks}$01;
  253.     kQ3EndCapMaskBottom            = {TQ3EndCapMasks}$02;
  254.     kQ3EndCapMaskInterior        = {TQ3EndCapMasks}$04;
  255.  
  256.  
  257. TYPE
  258.     TQ3EndCap                            = UInt32;
  259.  
  260. CONST
  261.     kQ3ArrayIndexNULL            = -1;
  262.  
  263. {*****************************************************************************
  264.  **                                                                             **
  265.  **                        Point and Vector Definitions                         **
  266.  **                                                                             **
  267.  ****************************************************************************}
  268.  
  269. TYPE
  270.     TQ3Vector2DPtr = ^TQ3Vector2D;
  271.     TQ3Vector2D = RECORD
  272.         x:                        Single;
  273.         y:                        Single;
  274.     END;
  275.  
  276.     TQ3Vector3DPtr = ^TQ3Vector3D;
  277.     TQ3Vector3D = RECORD
  278.         x:                        Single;
  279.         y:                        Single;
  280.         z:                        Single;
  281.     END;
  282.  
  283.     TQ3Point2DPtr = ^TQ3Point2D;
  284.     TQ3Point2D = RECORD
  285.         x:                        Single;
  286.         y:                        Single;
  287.     END;
  288.  
  289.     TQ3Point3DPtr = ^TQ3Point3D;
  290.     TQ3Point3D = RECORD
  291.         x:                        Single;
  292.         y:                        Single;
  293.         z:                        Single;
  294.     END;
  295.  
  296.     TQ3RationalPoint4DPtr = ^TQ3RationalPoint4D;
  297.     TQ3RationalPoint4D = RECORD
  298.         x:                        Single;
  299.         y:                        Single;
  300.         z:                        Single;
  301.         w:                        Single;
  302.     END;
  303.  
  304.     TQ3RationalPoint3DPtr = ^TQ3RationalPoint3D;
  305.     TQ3RationalPoint3D = RECORD
  306.         x:                        Single;
  307.         y:                        Single;
  308.         w:                        Single;
  309.     END;
  310.  
  311. {*****************************************************************************
  312.  **                                                                             **
  313.  **                                Quaternion                                     **
  314.  **                                                                             **
  315.  ****************************************************************************}
  316.     TQ3QuaternionPtr = ^TQ3Quaternion;
  317.     TQ3Quaternion = RECORD
  318.         w:                        Single;
  319.         x:                        Single;
  320.         y:                        Single;
  321.         z:                        Single;
  322.     END;
  323.  
  324. {*****************************************************************************
  325.  **                                                                             **
  326.  **                                Ray Definition                                 **
  327.  **                                                                             **
  328.  ****************************************************************************}
  329.     TQ3Ray3DPtr = ^TQ3Ray3D;
  330.     TQ3Ray3D = RECORD
  331.         origin:                    TQ3Point3D;
  332.         direction:                TQ3Vector3D;
  333.     END;
  334.  
  335. {*****************************************************************************
  336.  **                                                                             **
  337.  **                        Parameterization Data Structures                     **
  338.  **                                                                             **
  339.  ****************************************************************************}
  340.     TQ3Param2DPtr = ^TQ3Param2D;
  341.     TQ3Param2D = RECORD
  342.         u:                        Single;
  343.         v:                        Single;
  344.     END;
  345.  
  346.     TQ3Param3DPtr = ^TQ3Param3D;
  347.     TQ3Param3D = RECORD
  348.         u:                        Single;
  349.         v:                        Single;
  350.         w:                        Single;
  351.     END;
  352.  
  353.     TQ3Tangent2DPtr = ^TQ3Tangent2D;
  354.     TQ3Tangent2D = RECORD
  355.         uTangent:                TQ3Vector3D;
  356.         vTangent:                TQ3Vector3D;
  357.     END;
  358.  
  359.     TQ3Tangent3DPtr = ^TQ3Tangent3D;
  360.     TQ3Tangent3D = RECORD
  361.         uTangent:                TQ3Vector3D;
  362.         vTangent:                TQ3Vector3D;
  363.         wTangent:                TQ3Vector3D;
  364.     END;
  365.  
  366. {*****************************************************************************
  367.  **                                                                             **
  368.  **                        Polar and Spherical Coordinates                         **
  369.  **                                                                             **
  370.  ****************************************************************************}
  371.     TQ3PolarPointPtr = ^TQ3PolarPoint;
  372.     TQ3PolarPoint = RECORD
  373.         r:                        Single;
  374.         theta:                    Single;
  375.     END;
  376.  
  377.     TQ3SphericalPointPtr = ^TQ3SphericalPoint;
  378.     TQ3SphericalPoint = RECORD
  379.         rho:                    Single;
  380.         theta:                    Single;
  381.         phi:                    Single;
  382.     END;
  383.  
  384. {*****************************************************************************
  385.  **                                                                             **
  386.  **                            Color Definition                                 **
  387.  **                                                                             **
  388.  ****************************************************************************}
  389.     TQ3ColorRGBPtr = ^TQ3ColorRGB;
  390.     TQ3ColorRGB = RECORD
  391.         r:                        Single;
  392.         g:                        Single;
  393.         b:                        Single;
  394.     END;
  395.  
  396.     TQ3ColorARGBPtr = ^TQ3ColorARGB;
  397.     TQ3ColorARGB = RECORD
  398.         a:                        Single;
  399.         r:                        Single;
  400.         g:                        Single;
  401.         b:                        Single;
  402.     END;
  403.  
  404. {*****************************************************************************
  405.  **                                                                             **
  406.  **                                    Vertices                                 **
  407.  **                                                                             **
  408.  ****************************************************************************}
  409.     TQ3Vertex3DPtr = ^TQ3Vertex3D;
  410.     TQ3Vertex3D = RECORD
  411.         point:                    TQ3Point3D;
  412.         attributeSet:            TQ3AttributeSet;
  413.     END;
  414.  
  415. {*****************************************************************************
  416.  **                                                                             **
  417.  **                                    Matrices                                 **
  418.  **                                                                             **
  419.  ****************************************************************************}
  420.     TQ3Matrix3x3Ptr = ^TQ3Matrix3x3;
  421.     TQ3Matrix3x3 = RECORD
  422.         value:                    ARRAY [0..2,0..2] OF Single;
  423.     END;
  424.  
  425.     TQ3Matrix4x4Ptr = ^TQ3Matrix4x4;
  426.     TQ3Matrix4x4 = RECORD
  427.         value:                    ARRAY [0..3,0..3] OF Single;
  428.     END;
  429.  
  430. {*****************************************************************************
  431.  **                                                                             **
  432.  **                                Bitmap/Pixmap                                 **
  433.  **                                                                             **
  434.  ****************************************************************************}
  435.     TQ3PixmapPtr = ^TQ3Pixmap;
  436.     TQ3Pixmap = RECORD
  437.         image:                    Ptr;
  438.         width:                    UInt32;
  439.         height:                    UInt32;
  440.         rowBytes:                UInt32;
  441.         pixelSize:                UInt32;                                    {  MUST be 16 or 32 to use with the    Interactive Renderer on Mac OS }
  442.         pixelType:                TQ3PixelType;
  443.         bitOrder:                TQ3Endian;
  444.         byteOrder:                TQ3Endian;
  445.     END;
  446.  
  447.     TQ3StoragePixmapPtr = ^TQ3StoragePixmap;
  448.     TQ3StoragePixmap = RECORD
  449.         image:                    TQ3StorageObject;
  450.         width:                    UInt32;
  451.         height:                    UInt32;
  452.         rowBytes:                UInt32;
  453.         pixelSize:                UInt32;                                    {  MUST be 16 or 32 to use with the    Interactive Renderer on Mac OS }
  454.         pixelType:                TQ3PixelType;
  455.         bitOrder:                TQ3Endian;
  456.         byteOrder:                TQ3Endian;
  457.     END;
  458.  
  459.     TQ3BitmapPtr = ^TQ3Bitmap;
  460.     TQ3Bitmap = RECORD
  461.         image:                    Ptr;
  462.         width:                    UInt32;
  463.         height:                    UInt32;
  464.         rowBytes:                UInt32;
  465.         bitOrder:                TQ3Endian;
  466.     END;
  467.  
  468.     TQ3MipmapImagePtr = ^TQ3MipmapImage;
  469.     TQ3MipmapImage = RECORD
  470.                                                                         {  An image for use as a texture mipmap   }
  471.         width:                    UInt32;                                    {  Width of mipmap, must be power of 2    }
  472.         height:                    UInt32;                                    {  Height of mipmap, must be power of 2   }
  473.         rowBytes:                UInt32;                                    {  Rowbytes of mipmap                     }
  474.         offset:                    UInt32;                                    {  Offset from image base to this mipmap  }
  475.     END;
  476.  
  477.     TQ3MipmapPtr = ^TQ3Mipmap;
  478.     TQ3Mipmap = RECORD
  479.         image:                    TQ3StorageObject;                        {  Data containing the texture map and      }
  480.                                                                         {  if (useMipmapping==kQ3True) the          }
  481.                                                                         {  mipmap data                              }
  482.         useMipmapping:            TQ3Boolean;                                {  True if mipmapping should be used      }
  483.                                                                         {  and all mipmaps have been provided    }
  484.         pixelType:                TQ3PixelType;
  485.         bitOrder:                TQ3Endian;
  486.         byteOrder:                TQ3Endian;
  487.         reserved:                UInt32;                                    {  leave NULL for next version  }
  488.         mipmaps:                ARRAY [0..31] OF TQ3MipmapImage;        {  The actual number of mipmaps is          }
  489.                                                                         {  determined from the size of the          }
  490.                                                                         {  first mipmap                             }
  491.     END;
  492.  
  493.  
  494. {*****************************************************************************
  495.  **                                                                             **
  496.  **                        Higher dimension quantities                             **
  497.  **                                                                             **
  498.  ****************************************************************************}
  499.     TQ3AreaPtr = ^TQ3Area;
  500.     TQ3Area = RECORD
  501.         min:                    TQ3Point2D;
  502.         max:                    TQ3Point2D;
  503.     END;
  504.  
  505.     TQ3PlaneEquationPtr = ^TQ3PlaneEquation;
  506.     TQ3PlaneEquation = RECORD
  507.         normal:                    TQ3Vector3D;
  508.         constant:                Single;
  509.     END;
  510.  
  511.     TQ3BoundingBoxPtr = ^TQ3BoundingBox;
  512.     TQ3BoundingBox = RECORD
  513.         min:                    TQ3Point3D;
  514.         max:                    TQ3Point3D;
  515.         isEmpty:                TQ3Boolean;
  516.     END;
  517.  
  518.     TQ3BoundingSpherePtr = ^TQ3BoundingSphere;
  519.     TQ3BoundingSphere = RECORD
  520.         origin:                    TQ3Point3D;
  521.         radius:                    Single;
  522.         isEmpty:                TQ3Boolean;
  523.     END;
  524.  
  525. {
  526.  *    The TQ3ComputeBounds flag passed to StartBoundingBox or StartBoundingSphere
  527.  *    calls in the View. It's a hint to the system as to how it should 
  528.  *    compute the bbox of a shape:
  529.  *
  530.  *    kQ3ComputeBoundsExact:    
  531.  *        Vertices of shapes are transformed into world space and
  532.  *        the world space bounding box is computed from them.  Slow!
  533.  *    
  534.  *    kQ3ComputeBoundsApproximate: 
  535.  *        A local space bounding box is computed from a shape's
  536.  *        vertices.  This bbox is then transformed into world space,
  537.  *        and its bounding box is taken as the shape's approximate
  538.  *        bbox.  Fast but the bbox is larger than optimal.
  539.  }
  540.     TQ3ComputeBounds             = LONGINT;
  541. CONST
  542.     kQ3ComputeBoundsExact        = {TQ3ComputeBounds}0;
  543.     kQ3ComputeBoundsApproximate    = {TQ3ComputeBounds}1;
  544.  
  545.  
  546. {*****************************************************************************
  547.  **                                                                             **
  548.  **                            Object System Types                                 **
  549.  **                                                                             **
  550.  ****************************************************************************}
  551.  
  552. TYPE
  553.     TQ3XObjectClass = ^LONGINT;
  554.     TQ3XMethodType                        = UInt32;
  555. {
  556.  * Object methods
  557.  }
  558. {$IFC TYPED_FUNCTION_POINTERS}
  559.     TQ3XFunctionPointer = PROCEDURE; C;
  560. {$ELSEC}
  561.     TQ3XFunctionPointer = ProcPtr;
  562. {$ENDC}
  563.  
  564. {$IFC TYPED_FUNCTION_POINTERS}
  565.     TQ3XMetaHandler = FUNCTION(methodType: TQ3XMethodType): TQ3XFunctionPointer; C;
  566. {$ELSEC}
  567.     TQ3XMetaHandler = ProcPtr;
  568. {$ENDC}
  569.  
  570. {
  571.  * MetaHandler:
  572.  *        When you give a metahandler to QuickDraw 3D, it is called multiple 
  573.  *        times to build method tables, and then is thrown away. You are 
  574.  *        guaranteed that your metahandler will never be called again after a 
  575.  *        call that was passed a metahandler returns.
  576.  *
  577.  *        Your metahandler should contain a switch on the methodType passed to it
  578.  *        and should return the corresponding method as an TQ3XFunctionPointer.
  579.  *
  580.  *        IMPORTANT: A metaHandler MUST always "return" a value. If you are
  581.  *        passed a methodType that you do not understand, ALWAYS return NULL.
  582.  *
  583.  *        These types here are prototypes of how your functions should look.
  584.  }
  585. {$IFC TYPED_FUNCTION_POINTERS}
  586.     TQ3XObjectUnregisterMethod = FUNCTION(objectClass: TQ3XObjectClass): TQ3Status; C;
  587. {$ELSEC}
  588.     TQ3XObjectUnregisterMethod = ProcPtr;
  589. {$ENDC}
  590.  
  591. {
  592.  * See QD3DIO.h for the IO method types: 
  593.  *        ObjectReadData, ObjectTraverse, ObjectWrite
  594.  }
  595.  
  596. {*****************************************************************************
  597.  **                                                                             **
  598.  **                                Set Types                                     **
  599.  **                                                                             **
  600.  ****************************************************************************}
  601.     TQ3ElementType                        = LONGINT;
  602.  
  603. CONST
  604.     kQ3ElementTypeNone            = 0;
  605.     kQ3ElementTypeUnknown        = 32;
  606.     kQ3ElementTypeSet            = 33;
  607.  
  608.  *    kQ3ElementTypeUnknown is a TQ3Object. 
  609.  *    
  610.  *        Do Q3Set_Add(s, ..., &obj) or Q3Set_Get(s, ..., &obj);
  611.  *        
  612.  *        Note that the object is always referenced when copying around. 
  613.  *        
  614.  *        Generally, it is an Unknown object, a Group of Unknown objects, or a 
  615.  *        group of other "objects" which have been found in the metafile and
  616.  *        have no attachment method to their parent. Be prepared to handle
  617.  *        any or all of these cases if you actually access the set on a shape.
  618.  *
  619.  *    kQ3ElementTypeSet is a TQ3SetObject. 
  620.  *    
  621.  *        Q3Shape_GetSet(s,&o) is eqivalent to 
  622.  *            Q3Shape_GetElement(s, kQ3ElementTypeSet, &o)
  623.  *            
  624.  *        Q3Shape_SetSet(s,o)  is eqivalent to 
  625.  *            Q3Shape_SetElement(s, kQ3ElementTypeSet, &o)
  626.  *    
  627.  *        Note that the object is always referenced when copying around. 
  628.  *        
  629.  *    See the note below about the Set and Shape changes.
  630.  }
  631.  
  632. {*****************************************************************************
  633.  **                                                                             **
  634.  **                            Object System Macros                             **
  635.  **                                                                             **
  636.  ****************************************************************************}
  637. {*****************************************************************************
  638.  **                                                                             **
  639.  **                                Object Types                                 **
  640.  **                                                                             **
  641.  ****************************************************************************}
  642. {
  643.  * Note:    a call to Q3Foo_GetType will return a value kQ3FooTypeBar
  644.  *            e.g. Q3Shared_GetType(object) returns kQ3SharedTypeShape, etc.
  645.  }
  646.     kQ3ObjectTypeInvalid        = 0;
  647.     kQ3ObjectTypeView            = 'view';
  648.     kQ3ObjectTypeElement        = 'elmn';
  649.     kQ3ElementTypeAttribute        = 'eatt';
  650.     kQ3ObjectTypePick            = 'pick';
  651.     kQ3PickTypeWindowPoint        = 'pkwp';
  652.     kQ3PickTypeWindowRect        = 'pkwr';
  653.     kQ3ObjectTypeShared            = 'shrd';
  654.     kQ3SharedTypeRenderer        = 'rddr';
  655.     kQ3RendererTypeWireFrame    = 'wrfr';
  656.     kQ3RendererTypeGeneric        = 'gnrr';
  657.     kQ3RendererTypeInteractive    = 'ctwn';
  658.     kQ3SharedTypeShape            = 'shap';
  659.     kQ3ShapeTypeGeometry        = 'gmtr';
  660.     kQ3GeometryTypeBox            = 'box ';
  661.     kQ3GeometryTypeGeneralPolygon = 'gpgn';
  662.     kQ3GeometryTypeLine            = 'line';
  663.     kQ3GeometryTypeMarker        = 'mrkr';
  664.     kQ3GeometryTypePixmapMarker    = 'mrkp';
  665.     kQ3GeometryTypeMesh            = 'mesh';
  666.     kQ3GeometryTypeNURBCurve    = 'nrbc';
  667.     kQ3GeometryTypeNURBPatch    = 'nrbp';
  668.     kQ3GeometryTypePoint        = 'pnt ';
  669.     kQ3GeometryTypePolygon        = 'plyg';
  670.     kQ3GeometryTypePolyLine        = 'plyl';
  671.     kQ3GeometryTypeTriangle        = 'trng';
  672.     kQ3GeometryTypeTriGrid        = 'trig';
  673.     kQ3GeometryTypeCone            = 'cone';
  674.     kQ3GeometryTypeCylinder        = 'cyln';
  675.     kQ3GeometryTypeDisk            = 'disk';
  676.     kQ3GeometryTypeEllipse        = 'elps';
  677.     kQ3GeometryTypeEllipsoid    = 'elpd';
  678.     kQ3GeometryTypePolyhedron    = 'plhd';
  679.     kQ3GeometryTypeTorus        = 'tors';
  680.     kQ3GeometryTypeTriMesh        = 'tmsh';
  681.     kQ3ShapeTypeShader            = 'shdr';
  682.     kQ3ShaderTypeSurface        = 'sush';
  683.     kQ3SurfaceShaderTypeTexture    = 'txsu';
  684.     kQ3ShaderTypeIllumination    = 'ilsh';
  685.     kQ3IlluminationTypePhong    = 'phil';
  686.     kQ3IlluminationTypeLambert    = 'lmil';
  687.     kQ3IlluminationTypeNULL        = 'nuil';
  688.     kQ3ShapeTypeStyle            = 'styl';
  689.     kQ3StyleTypeBackfacing        = 'bckf';
  690.     kQ3StyleTypeInterpolation    = 'intp';
  691.     kQ3StyleTypeFill            = 'fist';
  692.     kQ3StyleTypePickID            = 'pkid';
  693.     kQ3StyleTypeReceiveShadows    = 'rcsh';
  694.     kQ3StyleTypeHighlight        = 'high';
  695.     kQ3StyleTypeSubdivision        = 'sbdv';
  696.     kQ3StyleTypeOrientation        = 'ofdr';
  697.     kQ3StyleTypePickParts        = 'pkpt';
  698.     kQ3StyleTypeAntiAlias        = 'anti';
  699.     kQ3ShapeTypeTransform        = 'xfrm';
  700.     kQ3TransformTypeMatrix        = 'mtrx';
  701.     kQ3TransformTypeScale        = 'scal';
  702.     kQ3TransformTypeTranslate    = 'trns';
  703.     kQ3TransformTypeRotate        = 'rott';
  704.     kQ3TransformTypeRotateAboutPoint = 'rtap';
  705.     kQ3TransformTypeRotateAboutAxis = 'rtaa';
  706.     kQ3TransformTypeQuaternion    = 'qtrn';
  707.     kQ3TransformTypeReset        = 'rset';
  708.     kQ3ShapeTypeLight            = 'lght';
  709.     kQ3LightTypeAmbient            = 'ambn';
  710.     kQ3LightTypeDirectional        = 'drct';
  711.     kQ3LightTypePoint            = 'pntl';
  712.     kQ3LightTypeSpot            = 'spot';
  713.     kQ3ShapeTypeCamera            = 'cmra';
  714.     kQ3CameraTypeOrthographic    = 'orth';
  715.     kQ3CameraTypeViewPlane        = 'vwpl';
  716.     kQ3CameraTypeViewAngleAspect = 'vana';
  717.     kQ3ShapeTypeGroup            = 'grup';
  718.     kQ3GroupTypeDisplay            = 'dspg';
  719.     kQ3DisplayGroupTypeOrdered    = 'ordg';
  720.     kQ3DisplayGroupTypeIOProxy    = 'iopx';
  721.     kQ3GroupTypeLight            = 'lghg';
  722.     kQ3GroupTypeInfo            = 'info';
  723.     kQ3ShapeTypeUnknown            = 'unkn';
  724.     kQ3UnknownTypeText            = 'uktx';
  725.     kQ3UnknownTypeBinary        = 'ukbn';
  726.     kQ3ShapeTypeReference        = 'rfrn';
  727.     kQ3ReferenceTypeExternal    = 'rfex';
  728.     kQ3SharedTypeSet            = 'set ';
  729.     kQ3SetTypeAttribute            = 'attr';
  730.     kQ3SharedTypeDrawContext    = 'dctx';
  731.     kQ3DrawContextTypePixmap    = 'dpxp';
  732.     kQ3DrawContextTypeMacintosh    = 'dmac';
  733.     kQ3DrawContextTypeWin32DC    = 'dw32';
  734.     kQ3DrawContextTypeDDSurface    = 'ddds';
  735.     kQ3DrawContextTypeX11        = 'dx11';
  736.     kQ3SharedTypeTexture        = 'txtr';
  737.     kQ3TextureTypePixmap        = 'txpm';
  738.     kQ3TextureTypeMipmap        = 'txmm';
  739.     kQ3SharedTypeFile            = 'file';
  740.     kQ3SharedTypeStorage        = 'strg';
  741.     kQ3StorageTypeMemory        = 'mems';
  742.     kQ3MemoryStorageTypeHandle    = 'hndl';
  743.     kQ3StorageTypeUnix            = 'uxst';
  744.     kQ3UnixStorageTypePath        = 'unix';
  745.     kQ3StorageTypeMacintosh        = 'macn';
  746.     kQ3MacintoshStorageTypeFSSpec = 'macp';
  747.     kQ3StorageTypeWin32            = 'wist';
  748.     kQ3SharedTypeString            = 'strn';
  749.     kQ3StringTypeCString        = 'strc';
  750.     kQ3SharedTypeShapePart        = 'sprt';
  751.     kQ3ShapePartTypeMeshPart    = 'spmh';
  752.     kQ3MeshPartTypeMeshFacePart    = 'mfac';
  753.     kQ3MeshPartTypeMeshEdgePart    = 'medg';
  754.     kQ3MeshPartTypeMeshVertexPart = 'mvtx';
  755.     kQ3SharedTypeControllerState = 'ctst';
  756.     kQ3SharedTypeTracker        = 'trkr';
  757.     kQ3SharedTypeViewHints        = 'vwhn';
  758.     kQ3SharedTypeEndGroup        = 'endg';
  759.  
  760. {*****************************************************************************
  761.  **                                                                             **
  762.  **                            QuickDraw 3D System Routines                     **
  763.  **                                                                             **
  764.  ****************************************************************************}
  765. FUNCTION Q3Initialize: TQ3Status; C;
  766. FUNCTION Q3Exit: TQ3Status; C;
  767. FUNCTION Q3IsInitialized: TQ3Boolean; C;
  768. FUNCTION Q3GetVersion(VAR majorRevision: UInt32; VAR minorRevision: UInt32): TQ3Status; C;
  769. {
  770.  *  Q3GetReleaseVersion returns the release version number,
  771.  *  in the format of the first four bytes of a 'vers' resource
  772.  *  (e.g. 0x01518000 ==> 1.5.1 release).
  773.  }
  774. FUNCTION Q3GetReleaseVersion(VAR releaseRevision: UInt32): TQ3Status; C;
  775.  
  776. {*****************************************************************************
  777.  **                                                                             **
  778.  **                            ObjectClass Routines                             **
  779.  **                                                                             **
  780.  ****************************************************************************}
  781.  *  New object system calls to query the object system.
  782.  *
  783.  *  These comments to move to the stubs file before final release, they 
  784.  *  are here for documentation for developers using early seeds.
  785.  }
  786. {
  787.  *  Given a class name as a string return the associated class type for the 
  788.  *  class, may return kQ3Failure if the string representing the class is 
  789.  *  invalid.
  790.  }
  791. FUNCTION Q3ObjectHierarchy_GetTypeFromString(VAR objectClassString: TQ3ObjectClassNameString; VAR objectClassType: TQ3ObjectType): TQ3Status; C;
  792. {
  793.  *  Given a class type as return the associated string for the class name, 
  794.  *  may return kQ3Failure if the type representing the class is invalid.
  795.  }
  796. FUNCTION Q3ObjectHierarchy_GetStringFromType(objectClassType: TQ3ObjectType; VAR objectClassString: TQ3ObjectClassNameString): TQ3Status; C;
  797.  *  Return true if the class with this type is registered, false if not 
  798.  }
  799. FUNCTION Q3ObjectHierarchy_IsTypeRegistered(objectClassType: TQ3ObjectType): TQ3Boolean; C;
  800.  *  Return true if the class with this name is registered, false if not 
  801.  }
  802. FUNCTION Q3ObjectHierarchy_IsNameRegistered(objectClassName: ConstCStringPtr): TQ3Boolean; C;
  803. {
  804.  * TQ3SubClassData is used when querying the object system for
  805.  * the subclasses of a particular parent type:
  806.  }
  807.  
  808. TYPE
  809.     TQ3SubClassDataPtr = ^TQ3SubClassData;
  810.     TQ3SubClassData = RECORD
  811.         numClasses:                UInt32;                                    {  the # of subclass types found for a parent class  }
  812.         classTypes:                TQ3ObjectTypePtr;                        {  an array containing the class types  }
  813.     END;
  814.  
  815. {
  816.  *  Given a parent type and an instance of the TQ3SubClassData struct fill
  817.  *  it in with the number and class types of all of the subclasses immediately
  818.  *  below the parent in the class hierarchy.  Return kQ3Success to indicate no
  819.  *  errors occurred, else kQ3Failure.
  820.  *
  821.  *  NOTE:  This function will allocate memory for the classTypes array.  Be 
  822.  *    sure to call Q3ObjectClass_EmptySubClassData to free this memory up.
  823.  }
  824. FUNCTION Q3ObjectHierarchy_GetSubClassData(objectClassType: TQ3ObjectType; VAR subClassData: TQ3SubClassData): TQ3Status; C;
  825. {
  826.  *  Given an instance of the TQ3SubClassData struct free all memory allocated 
  827.  *    by the Q3ObjectClass_GetSubClassData call.
  828.  *
  829.  *  NOTE: This call MUST be made after a call to Q3ObjectClass_GetSubClassData
  830.  *  to avoid memory leaks.
  831.  }
  832. FUNCTION Q3ObjectHierarchy_EmptySubClassData(VAR subClassData: TQ3SubClassData): TQ3Status; C;
  833.  
  834. {*****************************************************************************
  835.  **                                                                             **
  836.  **                                Object Routines                                 **
  837.  **                                                                             **
  838.  ****************************************************************************}
  839. FUNCTION Q3Object_Dispose(object: TQ3Object): TQ3Status; C;
  840. FUNCTION Q3Object_Duplicate(object: TQ3Object): TQ3Object; C;
  841. FUNCTION Q3Object_Submit(object: TQ3Object; view: TQ3ViewObject): TQ3Status; C;
  842. FUNCTION Q3Object_IsDrawable(object: TQ3Object): TQ3Boolean; C;
  843. FUNCTION Q3Object_IsWritable(object: TQ3Object; theFile: TQ3FileObject): TQ3Boolean; C;
  844.  
  845. {*****************************************************************************
  846.  **                                                                             **
  847.  **                            Object Type Routines                             **
  848.  **                                                                             **
  849.  ****************************************************************************}
  850. FUNCTION Q3Object_GetType(object: TQ3Object): LONGINT; C;
  851. FUNCTION Q3Object_GetLeafType(object: TQ3Object): LONGINT; C;
  852. FUNCTION Q3Object_IsType(object: TQ3Object; theType: TQ3ObjectType): TQ3Boolean; C;
  853.  
  854. {*****************************************************************************
  855.  **                                                                             **
  856.  **                            Shared Object Routines                             **
  857.  **                                                                             **
  858.  ****************************************************************************}
  859. FUNCTION Q3Shared_GetType(sharedObject: TQ3SharedObject): LONGINT; C;
  860. FUNCTION Q3Shared_GetReference(sharedObject: TQ3SharedObject): TQ3SharedObject; C;
  861.  *    Q3Shared_IsReferenced
  862.  *        Returns kQ3True if there is more than one reference to sharedObject.
  863.  *        Returns kQ3False if there is ONE reference to sharedObject.
  864.  *    
  865.  *    This call is intended to allow applications and plug-in objects to delete
  866.  *    objects of which they hold THE ONLY REFERENCE. This is useful when
  867.  *    caching objects, etc.
  868.  *    
  869.  *    Although many may be tempted, DO NOT DO THIS:
  870.  *        while (Q3Shared_IsReferenced(foo)) ( Q3Object_Dispose(foo); )
  871.  *    
  872.  *    Your application will crash and no one will buy it. Chapter 11 is 
  873.  *    never fun (unless you short the stock). Thanks.
  874.  }
  875. FUNCTION Q3Shared_IsReferenced(sharedObject: TQ3SharedObject): TQ3Boolean; C;
  876. {
  877.  *    Q3Shared_GetEditIndex
  878.  *        Returns the "serial number" of sharedObject. Usefuly for caching 
  879.  *        object information. Returns 0 on error.
  880.  *        
  881.  *        Hold onto this number to determine if an object has changed since you
  882.  *        last built your caches... To validate, do:
  883.  *        
  884.  *        if (Q3Shared_GetEditIndex(foo) == oldFooEditIndex) (
  885.  *            // Cache is valid
  886.  *        ) else (
  887.  *            // Cache is invalid
  888.  *            RebuildSomeSortOfCache(foo);
  889.  *            oldFooEditIndex = Q3Shared_GetEditIndex(foo);
  890.  *        )
  891.  }
  892. FUNCTION Q3Shared_GetEditIndex(sharedObject: TQ3SharedObject): UInt32; C;
  893. {
  894.  *    Q3Shared_Edited
  895.  *        Bumps the "serial number" of sharedObject to a different value. This
  896.  *        call is intended to be used solely from a plug-in object which is 
  897.  *        shared. Call this whenever your private instance data changes.
  898.  *        
  899.  *        Returns kQ3Failure iff sharedObject is not a shared object, OR
  900.  *            QuickDraw 3D isn't initialized.
  901.  }
  902. FUNCTION Q3Shared_Edited(sharedObject: TQ3SharedObject): TQ3Status; C;
  903.  
  904. {*****************************************************************************
  905.  **                                                                             **
  906.  **                                Shape Routines                                 **
  907.  **                                                                             **
  908.  ****************************************************************************}
  909. {
  910.  *    QuickDraw 3D 1.1 Note:
  911.  *
  912.  *    Shapes and Sets are now (sort of) polymorphic.
  913.  *
  914.  *        You may call Q3Shape_Foo or Q3Set_Foo on a shape or a set.
  915.  *        The following calls are identical, in implementation:
  916.  *
  917.  *            Q3Shape_GetElement            =    Q3Set_Get
  918.  *            Q3Shape_AddElement            =    Q3Set_Add
  919.  *            Q3Shape_ContainsElement        =    Q3Set_Contains
  920.  *            Q3Shape_GetNextElementType    =    Q3Set_GetNextElementType
  921.  *            Q3Shape_EmptyElements        =    Q3Set_Empty
  922.  *            Q3Shape_ClearElement        =    Q3Set_Clear
  923.  *
  924.  *    All of these calls accept a shape or a set as their first parameter.
  925.  *
  926.  *    The Q3Shape_GetSet and Q3ShapeSetSet calls are implemented via a new
  927.  *    element type kQ3ElementTypeSet. See the note above about 
  928.  *    kQ3ElementTypeSet;
  929.  *
  930.  *    It is important to note that the new Q3Shape_...Element... calls do not
  931.  *    create a set on a shape and then add the element to it. This data is
  932.  *    attached directly to the shape. Therefore, it is possible for an element
  933.  *    to exist on a shape without a set existing on it as well. 
  934.  *
  935.  *    In your application, if you attach an element to a shape like this:
  936.  *        (this isn't checking for errors for simplicity)
  937.  *
  938.  *        set = Q3Set_New();
  939.  *        Q3Set_AddElement(set, kMyElemType, &data);
  940.  *        Q3Shape_SetSet(shape, set);
  941.  *
  942.  *    You should retrieve it in the same manner:
  943.  *
  944.  *        Q3Shape_GetSet(shape, &set);
  945.  *        if (Q3Set_Contains(set, kMyElemType) == kTrue) (
  946.  *            Q3Set_Get(set, kMyElemType, &data);
  947.  *        )
  948.  *
  949.  *    Similarly, if you attach data to a shape with the new calls:
  950.  *
  951.  *        Q3Shape_AddElement(shape, kMyElemType, &data);
  952.  *
  953.  *    You should retrieve it in the same manner:
  954.  *
  955.  *        if (Q3Shape_ContainsElement(set, kMyElemType) == kTrue) (
  956.  *            Q3Shape_GetElement(set, kMyElemType, &data);
  957.  *        )
  958.  *
  959.  *    This really becomes an issue when dealing with version 1.0 and version 1.1 
  960.  *    metafiles.
  961.  *
  962.  *    When attempting to find a particular element on a shape, you should
  963.  *    first check with Q3Shape_GetNextElementType or Q3Shape_GetElement, then,
  964.  *    Q3Shape_GetSet(s, &set) (or Q3Shape_GetElement(s, kQ3ElementTypeSet, &set))
  965.  *    and then Q3Shape_GetElement(set, ...).
  966.  *
  967.  *    In terms of implementation, Q3Shape_SetSet and Q3Shape_GetSet should only be
  968.  *    used for sets of information that are shared among multiple shapes.
  969.  *    
  970.  *    Q3Shape_AddElement, Q3Shape_GetElement, etc. calls should only be used
  971.  *    for elements that are unique for a particular shape.
  972.  *    
  973.  }
  974. FUNCTION Q3Shape_GetType(shape: TQ3ShapeObject): LONGINT; C;
  975. FUNCTION Q3Shape_GetSet(shape: TQ3ShapeObject; VAR theSet: TQ3SetObject): TQ3Status; C;
  976. FUNCTION Q3Shape_SetSet(shape: TQ3ShapeObject; theSet: TQ3SetObject): TQ3Status; C;
  977. FUNCTION Q3Shape_AddElement(shape: TQ3ShapeObject; theType: TQ3ElementType; data: UNIV Ptr): TQ3Status; C;
  978. FUNCTION Q3Shape_GetElement(shape: TQ3ShapeObject; theType: TQ3ElementType; data: UNIV Ptr): TQ3Status; C;
  979. FUNCTION Q3Shape_ContainsElement(shape: TQ3ShapeObject; theType: TQ3ElementType): TQ3Boolean; C;
  980. FUNCTION Q3Shape_GetNextElementType(shape: TQ3ShapeObject; VAR theType: TQ3ElementType): TQ3Status; C;
  981. FUNCTION Q3Shape_EmptyElements(shape: TQ3ShapeObject): TQ3Status; C;
  982. FUNCTION Q3Shape_ClearElement(shape: TQ3ShapeObject; theType: TQ3ElementType): TQ3Status; C;
  983.  
  984. {*****************************************************************************
  985.  **                                                                             **
  986.  **                            Color Table Routines                             **
  987.  **                                                                             **
  988.  ****************************************************************************}
  989. FUNCTION Q3Bitmap_Empty(VAR bitmap: TQ3Bitmap): TQ3Status; C;
  990. FUNCTION Q3Bitmap_GetImageSize(width: UInt32; height: UInt32): UInt32; C;
  991.  
  992.  
  993. {$ALIGN RESET}
  994. {$POP}
  995.  
  996. {$SETC UsingIncludes := QD3DIncludes}
  997.  
  998. {$ENDC} {__QD3D__}
  999.  
  1000. {$IFC NOT UsingIncludes}
  1001.  END.
  1002. {$ENDC}
  1003.